package org.elsfs.cloud.common.mybatis.ext.sql.support.condition;


import org.elsfs.cloud.common.mybatis.ext.sql.SqlParameterManager;
import org.elsfs.cloud.common.util.lang.NamingCase;

/**
 * 非区间开始值条件
 *

 */
public class NotBetweenBeginValueConditionItem extends BetweenBeginValueConditionItem {

    public NotBetweenBeginValueConditionItem(SqlParameterManager sqlParameterManager, String leftField, Object beginValue, String endField) {
        super(sqlParameterManager, leftField, beginValue, endField);
    }

    /**
     * 构建SQL片段
     *
     * @return SQL片段
     */
    @Override
    public String buildSqlFragment() {
        return String.format(
            "%s NOT BETWEEN %s AND %s",
            NamingCase.toUnderlineCase(this.leftField),
            SqlParameterManager.buildParameterPlaceholder(
                this.sqlParameterManager.registerParameter(this.beginValue)
            ),
            NamingCase.toUnderlineCase(this.endField)
        );
    }
}
